package com.zy.explore.client.infrastructure.util;

import cn.hutool.core.lang.UUID;
import org.hibernate.HibernateException;
import org.hibernate.engine.spi.SharedSessionContractImplementor;
import org.hibernate.id.UUIDGenerator;
import tk.mybatis.mapper.genid.GenId;
import java.io.Serializable;

/**
 * 建类说明：uuid生成器
 * 当前版本：1.0.0
 *
 * @author 🇨🇳中国印🇨🇳
 * @date 2022年04月17日 02:38:46
 * @since 1.0.0
 */
public class MyUUIDGenerator extends UUIDGenerator implements GenId<String> {

    @Override
    public Serializable generate(SharedSessionContractImplementor session, Object object) throws HibernateException {
        // return Snowflake.pkID();
        return UUID.fastUUID().toString().replace("-", "");
    }
    @Override
    public String genId(String s, String s1) {
        //return Snowflake.pkID();
        return UUID.fastUUID().toString().replace("-", "");
    }
}
